package net.javlov.vf.fa;

import net.javlov.Option;
import net.javlov.vf.OptionValues;

public interface LinearFATraces {

	/**
	 * Get the trace matrix, one row per option, one column per feature.
	 * 
	 * @return the trace matrix
	 */
	public double[][] get();
	
	/**
	 * 
	 * @return the matrix of indices of features that have traces above threshold.
	 */
	public int[][] getLiveIndices();
	
	//TODO too specific
	/**
	 * 
	 * @return number of nonzero traces per option
	 */
	public int[] getNumNonZero();
	
	/**
	 * Update (decay) the traces. The state-option pair passed is the last visited one and
	 * traces for this pair should thus be "visited" (e.g. set traces to 1) rather than decayed.
	 * The option values are passed in for flexibility; some tracing methods (e.g. Watkins)
	 * might need it to determine how to update the traces.
	 * 
	 * @param s the last visited state
	 * @param o the last visited option
	 * @param stateCoding the encoding of the state into feature values
	 */
	public void update(double[] featVals, Option<?> o, OptionValues values);
	
	/**
	 * 
	 * @param s the last visited state
	 * @param o the last visited option
	 * @param stateCoding the encoding of the state into feature values
	 * @param featIdx the features that are nonzero in the encoding of the state. For tile coding and
	 * other binary approximators for which only a small percentage of features is nonzero.
	 */
	public void update(double[] featVals, Option<?> o, int[] featIdx, OptionValues values);

}
